---
sidebar_label: Remote Schemas
sidebar_position: 10
description: Manage Remote Schemas with the Hasura schema/Metadata API
keywords:
  - hasura
  - docs
  - schema/Metadata API
  - API reference
  - remote schema
---

# Schema/Metadata API Reference: Remote Schemas (Deprecated)

:::caution Deprecation

In versions `v2.0.0` and above, the schema/Metadata API is deprecated in
favour of the [schema API](/api-reference/schema-api/index.mdx) and the
[Metadata API](/api-reference/metadata-api/index.mdx).

Though for backwards compatibility, the schema/Metadata APIs will
continue to function.

:::

## Introduction

Add/Remove a remote GraphQL server as Remote Schema in Hasura GraphQL Engine.

## add_remote_schema {#schema-metadata-add-remote-schema}

`add_remote_schema` is used to add a remote GraphQL server as remote
schema. GraphQL Engine stitches it's schema with existing.

An example request as follows:

```http
POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin

{
    "type": "add_remote_schema",
    "args": {
        "name": "my remote schema",
        "definition": {
            "url": "https://remote-server.com/graphql",
            "headers": [{"name": "X-Server-Request-From", "value": "Hasura"}],
            "forward_client_headers": false,
            "timeout_seconds": 60
        },
        "comment": "some optional comment"
    }
}
```

### Args syntax {#schema-metadata-add-remote-schema-syntax}

| Key        | Required | Schema                                                              | Description                      |
| ---------- | -------- | ------------------------------------------------------------------- | -------------------------------- |
| name       | true     | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the Remote Schema        |
| definition | true     | [RemoteSchemaDef](/api-reference/syntax-defs.mdx#remoteschemadef)   | Definition for the Remote Schema |
| comment    | false    | Text                                                                | comment                          |

## update_remote_schema {#schema-metadata-update-remote-schema}

`update_remote_schema` is used to update the configuration of a remote
schema. If the Remote Schema URL has changed then it will perform a
introspection as well. After introspection, if there are any
inconsistencies detected with other Metadata objects (like remote
relationships or Remote Schema permissions) they will be reported as
_inconsistent_metadata_.

An example request as follows:

```http
POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin

{
    "type": "update_remote_schema",
    "args": {
        "name": "my remote schema",
        "definition": {
            "url": "https://remote-server.com/graphql",
            "headers": [{"name": "X-Server-Request-From", "value": "Hasura"}],
            "forward_client_headers": false,
            "timeout_seconds": 60
        },
        "comment": "some optional comment"
    }
}
```

### Args syntax {#schema-metadata-update-remote-schema-syntax}

| Key        | Required | Schema                                                              | Description                      |
| ---------- | -------- | ------------------------------------------------------------------- | -------------------------------- |
| name       | true     | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the Remote Schema        |
| definition | true     | [RemoteSchemaDef](/api-reference/syntax-defs.mdx#remoteschemadef)   | Definition for the Remote Schema |
| comment    | false    | Text                                                                | comment                          |

## remove_remote_schema {#schema-metadata-remove-remote-schema}

`remove_remote_schema` is used to delete a Remote Schema. GraphQL Engine
de-stitches it's schema.

An example request as follows:

```http
POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin

{
    "type": "remove_remote_schema",
    "args": {
        "name": "my remote schema"
    }
}
```

### Args syntax {#schema-metadata-remove-remote-schema-syntax}

| Key  | Required | Schema                                                              | Description               |
| ---- | -------- | ------------------------------------------------------------------- | ------------------------- |
| name | true     | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the Remote Schema |

## reload_remote_schema {#schema-metadata-reload-remote-schema}

`reload_remote_schema` is used to refresh schema of the remote server.
GraphQL Engine refetches schema from server and stitches.

An example request as follows:

```http
POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin

{
    "type": "reload_remote_schema",
    "args": {
        "name": "my remote schema"
    }
}
```

### Args syntax {#schema-metadata-reload-remote-schema-syntax}

| Key  | Required | Schema                                                              | Description               |
| ---- | -------- | ------------------------------------------------------------------- | ------------------------- |
| name | true     | [RemoteSchemaName](/api-reference/syntax-defs.mdx#remoteschemaname) | Name of the Remote Schema |
